package cn.signalpha.modules.shop.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 数据传输对象实体类
 *
 * @author signalpha
 */
@Data
@ApiModel(value = "PublicityGoodsDTO对象", description = "营销推广商品")
public class PublicityGoodsDTO implements Serializable {
    private static final long serialVersionUID = 1L;

	@Data
	public static class SaveDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "营销推广id")
		private Long publicityId;
		@NotBlank
		@ApiModelProperty(value = "商品id")
		private String goodsIds;
		@ApiModelProperty(value = "配置")
		private String config;
	}

	@Data
	public static class UpdateDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "id")
		private Long id;
		@NotBlank
		@ApiModelProperty(value = "配置")
		private String config;
	}

	/**
	 * 限时秒杀配置
	 */
	@Data
	public static class LimitTimeSecKillDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "限制购买数")
		private Integer limitNum;
		@ApiModelProperty(value = "商品规格列表")
		private List<LimitTimeSecKillDetailDTO> detailList;
	}
	@Data
	public static class LimitTimeSecKillDetailDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "规格")
		private String spec;
		@ApiModelProperty(value = "规格名，前端用")
		private String specStr;
		@ApiModelProperty(value = "活动价")
		private Double price;
		@ApiModelProperty(value = "库存")
		private Integer stock;
		@ApiModelProperty(value = "销量")
		private Integer salesVolume;
	}


	/**
	 * 限时折扣配置
	 */
	@Data
	public static class LimitTimeDiscountDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "类型：1固定折扣 2固定减价 3固定价格")
		private Integer type;
		@ApiModelProperty(value = "限制购买数")
		private Integer limitNum;
		@ApiModelProperty(value = "商品规格列表")
		private List<LimitTimeDiscountDetailDTO> detailList;
	}
	@Data
	public static class LimitTimeDiscountDetailDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "规格")
		private String spec;
		@ApiModelProperty(value = "规格名，前端用")
		private String specStr;
		@ApiModelProperty(value = "活动价, 折扣是0.01~10，减价和固定价格不能超过原价")
		private Double price;
		@ApiModelProperty(value = "库存")
		private Integer stock;
		@ApiModelProperty(value = "销量")
		private Integer salesVolume;
	}


}
